﻿/// <reference path="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4-vsdoc.js" />

/*
JavaScript functions for the Settings.aspx page
*/

$(document).ready(function () {
    //get the page request manager
    var pageReqMgr = Sys.WebForms.PageRequestManager.getInstance();

    //add request for invoking the functions when UpdatePanel has finished loading
    pageReqMgr.add_endRequest(InitValidation);

    //add request for invoking the functions before UpdatePanel starts postback
    pageReqMgr.add_initializeRequest(CheckFormValid);
});

function InitValidation() {

    $("#aspnetForm").validate();
}

function CheckFormValid(sender, args) {

    var isValid = $("#aspnetForm").valid();

    // Check to see if we need to Cancel this Postback based on Conditional Logic within this page.. 
    args.set_cancel(!isValid);
} 

